/**
 * 
 */
package reinvent.d.wheel.UM.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import reinvent.d.wheel.UM.exception.UserdefinitionNotTrueException;

/**
 * @author nishant.awasthi
 *
 */
@Entity
@Table(name = "User")
public class User implements Serializable{
	
	
	private int userId;
	
	private String uname;
	
	private String password;
	
	private String email;
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}
	
	
	@Column(name = "username",nullable=false)
	public String getUname() {
		return uname;
	}

	public void setUname(String uname) {
		this.uname = uname;
	}
	
	@Column(name = "password",nullable=false)
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	@Column(name = "email",nullable=true)
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * 
	 */
	public User() {
		
	}
	
	public User(String uname,String password,String email) throws UserdefinitionNotTrueException{
		if(uname==null || password==null){
			throw new UserdefinitionNotTrueException("either uname or password is null");
		}
		this.uname=uname;
		this.password=password;
		this.email=email;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
